#include "udplib.h"
int main(){

printf(" ... test updlib ...\n\n");
int semid;
int shmid;
void* mem;
int sock;
/*Das Programm bricht beim fehler in einem Test ab*/
/// testgetsharedMemory
	printf("testgetSharedMemory...\n");
	shmid = getSharedMemory(getpid(), IPC_CREAT|0777, sizeof(int));
	printf("testgetSharedMemory ok\n\n");
/// testinitsharedMemory
	printf("testinitsharedMemory...\n");
	mem = shmat(shmid, 0, 0);
	initSharedMemory(mem, sizeof(int));
	printf("testinitsharedMemory ok\n\n");
/// testgetSemaphor
	// 2 Semaphoren erzeugen
	printf("testgetSemaphor...\n");
	semid = getSemaphor(getpid(), 2, IPC_CREAT|0777);
	printf("testgetSemaphor ok\n\n");
/// testinitSemaphor
	printf("testinitSemaphor...\n");
	initSemaphor(semid, 0, 0);
	initSemaphor(semid, 1, 3);
	printf("testinitSemaphor ok\n\n");
/// testup
	printf("testup ...\n");
	up(semid, 0);
	printf("testup ok\n\n");
/// testdown
	printf("testdown ...\n");
	down(semid, 1);
	down(semid, 1);
	down(semid, 1);
	printf("testdown ok\n\n");
/// testgetSocket
	printf("testgetSocket ...\n");
	sock = getSocket(4444);
	if(sock < 0)	// Fehler
		printf("testgetSocket nicht ok\n");
	else
		printf("testgetSocket ok\n");
	
return 0;
}
